package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.MySpBean;
import com.lwj.liwanjia.impl.MySpView;
import com.lwj.liwanjia.model.MySpModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2018/1/12.
 */

public class MySpPresenter {
    private MySpView mySpView;
    private MySpModel mySpModel;

    public MySpPresenter(MySpView mySpView) {
        this.mySpView = mySpView;
        this.mySpModel = new MySpModel();
    }

    public void getMySpData(String token) {
        mySpModel.getMySpData(token, new Subscriber<MySpBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                mySpView.showError((Exception) e);
            }

            @Override
            public void onNext(MySpBean mySpBean) {
                mySpView.getMySpData(mySpBean);
            }
        });
    }
}
